/*
 *
 * @ProjectName:    my_umi_app
 * @Package:
 * @ClassName:      home_content
 * @Description:    JSX文件
 * @Author:         SuPeiSen
 * @CreateDate:     2021/2/24 4:27 下午
 * @UpdateDate:     2021/2/24 4:27 下午
 * @UpdateRemark:   更新说明：
 * @Version:        1.0
 */

import { Ad } from '@/pages/blog/ad/ad';
import React from 'react';
import './style/home_content.less';
import './phone_style/phone_home_content.less';
import { useViewport } from '@/provider/viewport_context';
import ArticleList from '@/pages/blog/article/article_list';

export const HomeContent = (props: { children: JSX.Element }) => {
  const { type } = useViewport();
  const locationUrl = window.location.pathname;
  // @ts-ignore
  const articleList = <ArticleList />;
  return (
    <div
      className="hone_content"
      style={{ padding: type === 'pc' ? '0 10%' : '0' }}
    >
      {/*左边的内容区域*/}
      <div
        style={{ width: type === 'pc' ? '75%' : '100%' }}
        className="hone_content_article"
      >
        {locationUrl === '/' ? articleList : props.children}
      </div>

      {/*广告区域*/}
      <div
        style={{ width: type === 'pc' ? '25%' : '0' }}
        className="hone_content_ad"
      >
        <Ad />
      </div>
    </div>
  );
};
